package com.pacy.pacybaseproject.utils;

/**
 * @author PACY
 * @date 2024/4/16
 * description:
 */
public class XUtils {
    public static String formatDistance(int m){
        if(m<1000){
            return m+"米";
        }
        return doubleTrans(Math.round( m / 100d) / 10d)+"公里";
    }

    /**
     * 对double类型数据操作   忽略.0	 * @param d	 * @return
     */
    public static String doubleTrans(double d) {
        if (Math.round(d) - d == 0) {
            return String.valueOf((long) d);
        }
        return String.valueOf(d);
    }
}
